#ifndef DECOMPONENT_TRANSFORM_H
#define DECOMPONENT_TRANSFORM_H

#include "glm.hpp"
#include "gtc/quaternion.hpp"
#include "gtx/quaternion.hpp"

#include "AComponent.h"

class GameNode;

class Transform
	: public AComponent
{
private:
	glm::mat4 mPosMatrix;
	glm::mat4 mRotMatrix;
	glm::mat4 mScaleMatrix;

	glm::vec3 mPosition;
	glm::quat mRotation;
	glm::vec3 mScale;

	glm::vec3 mLocalPosition;
	glm::quat mLocalRotation;

	glm::vec3 mForward;
	glm::vec3 mRight;
	glm::vec3 mUp;

	glm::mat4 mMatrix;
	bool	  mWasModified;

public:
	Transform(RefPtr<GameNode> pNode);

	void		setLocalPosition(glm::vec3 pPos);
	glm::vec3	getLocalPosition(){ return mLocalPosition; }

	void		setLocalRotation(glm::quat pRot);
	glm::quat	getLocalRotation(){return mLocalRotation;}

	void		setScale(glm::vec3 pScale){ mScale = pScale;}
	glm::vec3	getScale(){ return mScale;}

	void		setPosition(glm::vec3 pPos);
	glm::vec3	getPosition(){ return mPosition; }

	void		setRotation(glm::quat pRot);
	glm::quat	getRotation(){ return mRotation; }

	void		rotateLocalAround(const glm::vec3 &pAxis, const float & pAngle);
	void		rotateAround(const glm::vec3 &pAxis, const float &pAngle);

	void		Update();

	glm::mat4	getMatrix();
	//Get the following vector in WORLD space
	glm::vec3	getForward();
	glm::vec3	getRight();
	glm::vec3	getUp();
};

#endif